//
//  UIBarButtonItem+Extension.swift
//  SinaWeibo
//
//  Created by paycloud110 on 16/6/2.
//  Copyright © 2016年 paycloud110. All rights reserved.
//

import UIKit

extension UIBarButtonItem
{
    convenience init(imageName: String, target: AnyObject, action: Selector)
    {
        let button = UIButton()
        button.setImage(UIImage(named: imageName), forState: .Normal)
        button.setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        button.sizeToFit()
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        self.init(customView: button)
    }
}